/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.garethc.chpt2.arraycalculator.arraycalc.impl;

import za.ac.cput.garethc.chpt2.arraycalculator.arraycalc.ArrayCalc;


/**
 *
 * @author Gareth
 */
public class ArrayCalcImpl implements ArrayCalc
{

    @Override
    public int addArray(int[] numbers) 
    {
        int ans = 0;
        for (int i = 0; i < numbers.length; i++)
        {
            ans += numbers[i];
        }
        
        return ans;
    }

    @Override
    public int subtractArray(int[] numbers) 
    {
        int ans = numbers[0];
        for (int i = 1; i < numbers.length; i++)
        {
            ans -= numbers[i];
        }
        
        return ans;
    }
    
}
